<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="com.bill.common.user.service.IRegisterUserService"%>
<%@page import="com.bill.common.user.dto.RegisterUserQueryDTO"%>
<%@page import="com.sinba.common.dto.PageDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/subAccountList.jsp");
	return;
}
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
RegisterUserQueryDTO qdto = new RegisterUserQueryDTO();
qdto.setParentAccount((String)session.getAttribute("loginName"));
int pages = 1;
String sidx = "createTime";
String sord="desc";
if(request.getParameter("pages")!=null && request.getParameter("_pages")!=""){
	pages = Integer.parseInt(request.getParameter("pages"));
}
int rows = 10;
int start = ( pages - 1 ) * rows;
qdto.setStart( start );
qdto.setLimit( rows );
PageDTO pageDTO = registerUserService.findSubUserPager(qdto, sord, sidx);
if(pageDTO!=null){
	pageDTO.setPage( pages );
	pageDTO.setRows( rows );
}
request.setAttribute("pageDTO",pageDTO);
%>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" >
<title><fmt:message key="i18n.myteam"/>-<fmt:message key="i18n.title"/></title>
<link rel="shortcut icon" href="../index/favicon.png" />
<link href="../skin/skin1/css/subPage.css" rel="stylesheet">
<link rel="stylesheet" href="css/sub_page_main_style.css" />
</head>
<body style="background:#fff;height:800px;">
<div class="account">
	<div class="top"><fmt:message key="i18n.userCenter"/> &gt; <fmt:message key="subAccountList"/> &nbsp; ( ${pageDTO.totalSize } )
	</div>
	<!-- <div class="left"></div> -->
    <div class="right" >
    	<%-- <h4><fmt:message key="i18n.list"/></h4> --%>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="smpl_tbl">
			<thead>
				<tr>
					<th><fmt:message key="i18n.type"/></th>
					<th><fmt:message key="i18n.userId"/></th>
					<th><fmt:message key="i18n.piUserName"/></th>
					<th><fmt:message key="i18n.regTime"/></th>
					<th><fmt:message key="DayFenHong"/></th>
					<th><fmt:message key="AllFenHong"/></th>
					<th><fmt:message key="i18n.operation"/></th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${pageDTO.data}" var="data">
					<tr class="color1">
						<td><fmt:message key="${data.registerLevel}" /></td>
						<td>${data.loginName}</td>
						<td>${data.userName}</td>
						<td><fmt:formatDate value="${data.registerTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
						<td><fmt:formatNumber value="${data.dayFenHong}" pattern="#0.0000"/></td>
						<td><fmt:formatNumber value="${data.allFenHong}" pattern="#0.0000"/></td>
						<td>
							<c:if test="${data.allFenHong >= 450}">
								<form action="extract!subAccountApply.action" method="post" onsubmit="return checkform();">
									<input type="hidden" name="extractDTO.loginName" value="${data.loginName }" />
									<input type="hidden" name="pageUrl" value="cashBusiness.jsp" />
									<input type="hidden" name="extractDTO.tixiangSum" value="450" />
									<input type="submit" value="<fmt:message key="TiXian" />" />
								</form>
								
							</c:if>
						</td>
					</tr>
				</c:forEach>
				<c:if test="${empty pageDTO.data}">
					<tr>
						<td colspan="7" align="center"><fmt:message key="i18n.noData"/>!</td>
					</tr>
				</c:if>
			</tbody>		        		
		</table>
		
		<div class="page">
		<div id="tr_recommendGrid_pager" class="page_r">
			<ul>
				<li><a href="subAccountList.jsp?pages=1"><fmt:message key="i18n.firstPage"/></a></li>
				<c:if test="${pageDTO.page!=1}">
					<li><a href="subAccountList.jsp?pages=${pageDTO.page-1}"><fmt:message key="i18n.upPage"/></a></li>
				</c:if>
				<li><a>${pageDTO.page}/${pageDTO.total}</a></li>
				<c:if test="${pageDTO.page+1<=pageDTO.total}">
					<li><a href="subAccountList.jsp?pages=${pageDTO.page+1}">-<fmt:message key="i18n.nextPage"/></a></li>
				</c:if>
				<li><a href="subAccountList.jsp?pages=${pageDTO.total}"><fmt:message key="i18n.endPage"/></a></li>
				<li><a><fmt:message key="i18n.total"/>${pageDTO.totalSize}<fmt:message key="i18n.tiao"/></a></li>
			</ul>
		</div>
		</div>
    </div>
</div>
<script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>
<script>
function checkform(){
	var msg = "Are you sure you want to mention is it? Please confirm!\n\n您确定要提现吗？请确认！"; 
	if (confirm(msg)==true){ 
		return true; 
	}else{ 
		return false; 
	} 
}
</script>
</body>
</html>